<!DOCTYPE html>
<html>

<head>
    <title>系统通知</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="/js/bootstrap-4.1.1-dist/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/css/reset.css"/>
    <link rel="stylesheet" href="/css/message.css" />
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css"/>
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/checkLogin.js"></script>
    <script>
        $(function () {
            var user = JSON.parse(sessionStorage.getItem("user"));
            //当前页
            var currentPage = 1;
            var pageSize = 6;
            //总页数
            var pages;
            //存储游记的数组
            var systemNoticeArr = [];

            function query() {
                //获取全部通知
                $.get(baseUrl + "/systemNotice", {currentPage: currentPage, userId: user.id, pageSize: pageSize}, function (data) {
                    //把第二个数组合并第一个数组中
                    $.merge(systemNoticeArr, data.list);
                    var json = {
                        list: systemNoticeArr
                    };
                    //渲染数据
                    console.log(json);
                    $(".systemMsg").renderValues(json);
                    //获取总页数
                    pages = data.pages;
                    /*$(".list a").attr("style", "color:rgb(89, 175, 247)");  蓝色*/
                    $(".list a").attr("style", "color:rgb(247, 119, 183)"); // 粉色
                });
                currentPage = currentPage + 1;
            }
            //默认查询第一页
            query();
            //给window绑定滚动事件
            $(window).scroll(function () {
                if ($(window).height() + $(document).scrollTop()  >= $(document).height()) {
                    //如果是小于总页数就发送请求
                    if (currentPage <= pages) {
                        query();
                    } else {
                        $(document).dialog({
                            type: 'notice',
                            content: '<span class="info-text">我是有底线的!</span>',
                            autoClose: 1500
                        });
                    }
                }
            });
        });
    </script>
</head>

<body>
<div class="search-head">
    <div class="row nav-search">
        <div class="col">
            <a href="javascript:history.go(-1);">
                <span><i class="fa fa-chevron-left" ></i></span>
            </a>
        </div>
        <div class="col">
            <span>系统通知</span>
        </div>
        <div class="col"></div>
    </div>
</div>
<div class="container systemMsg">
    <div>
        <dl class="itemList">
            <div render-loop="list" class="list">
                <dd>
                    <p><strong style="color: #000;" render-html="list.msgInfo.title"></strong>
                        <!--<span style="padding-left: 20px" render-html="list.createtime"></span></p>-->
                    <p render-html="list.msgInfo.content"></p>
                    <p render-html="list.createtime"></p>
                </dd>
            </div>
        </dl>
    </div>
</div>
</body>

</html>